<?php require_once('header.php'); ?>
<?php //include_once('topwidget.php'); ?>

<div id="contentBox">
<?php include_once('sidebar.php'); ?>

<div id="content">
	<?php
	if(isset($_POST['Reply'])) {
		$msgid = $_GET['msgid'];
		$message = $_POST['message'];
		$receiverid = $_POST['receiverid'];
		$senderid = $_POST['senderid'];		
		
		mysql_connect("localhost", "root", "");
		mysql_select_db("jobsite") or die();
		
		$sendingmsg = "INSERT INTO reply(r_senderid, r_receiverid, msgid, r_message) VALUES('$senderid', '$receiverid', '$subject', '$message')";

		$query = mysql_query($sendingmsg);
		if($query) {
			echo "Successfully send!";
		} else {
			echo "Error!";
		}
	}
    ?>
    <div class="form">
        <form action="message.php" method="post">
            <fieldset>
                <legend>Send Reply</legend>
                <div class="inputArea">
                    <label for="input">Sending to</label>
                    <input style="border: none; background: none;" value="Sadek" disabled="disabled" />
                </div>
                <div class="inputArea">
                    <label for="input">Message</label>
                    <textarea name="r_message" rows="6"></textarea>
                </div>
                    <input type="hidden" value="1" name="r_receiverid" />
                    <input type="hidden" value="4" name="r_senderid" />
                <div class="inputArea">
                    <label for="input">&nbsp;</label>
                    <input type="submit" name="Reply" value="Send Reply" />
                </div>            
            </fieldset>
        </form>
    </div>
</div>
<div style="clear:both;"></div>

<?php //include_once('bottomwidget.php'); ?>
<?php include_once('footer.php'); ?>